Skip to content

[arm_variant_type migration] Only expand arm_variant_type if defined#8293

Open
traversaro wants to merge 1 commit intoconda-forge:mainfrom
traversaro:patch-48
Open

[arm_variant_type migration] Only expand arm_variant_type if defined#8293
traversaro wants to merge 1 commit intoconda-forge:mainfrom
traversaro:patch-48

Conversation

@traversaro
Copy link
Contributor

@traversaro traversaro commented Feb 28, 2026

Without this fix, defining touch_arm_variant_type as suggested results in a re-rendering failure.

fyi @conda-forge/cuda

Checklist

  • Used a personal fork of the feedstock to propose changes
  • Bumped the build number (if the version is unchanged)
  • Reset the build number to 0 (if the version changed)
  • Re-rendered with the latest conda-smithy (Use the phrase @conda-forge-admin, please rerender in a comment in this PR for automated rerendering)
  • Ensured the license file is being packaged.

Without this fix, defining touch_arm_variant_type as suggested results in a re-rendering failure
@traversaro traversaro requested a review from a team as a code owner February 28, 2026 17:06
@conda-forge-admin
Copy link
Contributor

Hi! This is the friendly automated conda-forge-linting service.

I just wanted to let you know that I linted all conda-recipes in your PR (recipe/meta.yaml) and found it was in an excellent condition.

I do have some suggestions for making it better though...

For recipe/meta.yaml:

  • ℹ️ The recipe is not parsable by parser conda-recipe-manager. The recipe can only be automatically migrated to the new v1 format if it is parseable by conda-recipe-manager.

This message was generated by GitHub Actions workflow run https://github.com/conda-forge/conda-forge-webservices/actions/runs/22525104535. Examine the logs at this URL for more detail.

@beckermr
Copy link
Member

Is the related to undefined variables causing issues in rattler-build 0.58.*?

@h-vetinari
Copy link
Member

Is the related to undefined variables causing issues in rattler-build 0.58.*?

Yeah, most likely...

Copy link
Member

@h-vetinari h-vetinari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's some more specific syntax than the (IMO pretty hacky) touch_ resp. fake selector. Not as a criticism of this PR (which is fine IMO), but as a potential improvement.

Comment on lines 53 to +55
context:
# ensure arm_variant_type gets detected as a used variable
touch_arm_variant_type: ${{ arm_variant_type }}
touch_arm_variant_type: ${{ arm_variant_type if (linux and aarch64 and cuda_compiler_version != "None") else "None" }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a cleaner way in v1 recipes that I hadn't been aware of until very recently, which might be preferable

build:
  variant:
    # ensure arm_variant_type gets detected as a used variable
    use_keys:
      - arm_variant_type

or, with the new, stricter rattler-build, probably also behind a if: linux and aarch64 and cuda_compiler_version != "None" guard.

Comment on lines 42 to 48
# A fake selector may be needed for conda-build to pick up arm_variant_type as a variant
# [arm_variant_type]

requirements:
build:
- {{ compiler('cuda') }}
- arm-variant * {{ arm_variant_type }} # [linux and aarch64 and cuda_compiler_version != "None"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It even has an equivalent in v0 recipes that I've never seen in conda-forge (so we should test if it works):

build:
  force_use_keys:
    - arm_variant_type

If so, it's probably more elegant than a fake selector...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok for me, but I would like to know the opinion of @conda-forge/cuda and @carterbox on this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that using the default filter on undefined values is fixed for rattler build, I suggest:

    - if: linux and aarch64 and not match(cuda_compiler_version, "==None")
      then:
        - arm-variant * ${{ arm_variant_type | default("None") }}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or perhaps I don't understand the issue being addressed by this MR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to clarify, the comment of @h-vetinari was on an existing part of the migrator, not the part subject of the PR.

@traversaro
Copy link
Contributor Author

Is the related to undefined variables causing issues in rattler-build 0.58.*?

I am not sure, I saw that touch_arm_variant_type was actually unused across conda-forge and the equivalent v0 construct had the preprocessor, and so it was assumed it was only a leftover, I did no tried with older rattler-build versions.

xref prefix-dev/rattler-build#2232

@traversaro
Copy link
Contributor Author

I just tested with rattler-build 0.58.4, and it is still failing the re-rendering in the current form:

✨ Pixi task (rerender in smithy): conda-smithy rerender: (Rerender the feedstock.)                                     INFO:conda_smithy.configure_feedstock:Downloading conda-forge-pinning-2026.03.05.07.27.18
INFO:conda_smithy.configure_feedstock:Extracting conda-forge-pinning to /home/straversaro/.cache/conda-smithy
INFO:conda_smithy.configure_feedstock:README rendering is skipped
INFO:conda_smithy.configure_feedstock:pytorch210.yaml from feedstock is ignored and upstream version is used
INFO:conda_smithy.configure_feedstock:python314.yaml from feedstock is ignored and upstream version is used
INFO:conda_smithy.configure_feedstock:arm_variant_type.yaml with timestamp 1738229377 does not exist in global pinning (anymore), removing it.
INFO:conda_smithy.configure_feedstock:If it should be applied nevertheless, check that migrator_ts/migration_number match the ones in https://github.com/conda-forge/conda-forge-pinning-feedstock/tree/main/recipe/migrations or add `use_local: true`.
INFO:conda_smithy.configure_feedstock:cuda130.yaml from feedstock is ignored and upstream version is used
WARNING: Setting build platform. This is only useful when pretending to be on another platform, such as for rendering necessary dependencies on a non-native platform. I trust that you know what you're doing.
WARNING: Setting build arch. This is only useful when pretending to be on another arch, such as for rendering necessary dependencies on a non-native arch. I trust that you know what you're doing.
WARNING: No numpy version specified in conda_build_config.yaml.  Falling back to default numpy value of 1.22
Adding in variants from internal_defaults
Adding in variants from /home/straversaro/.cache/conda-smithy/conda_build_config.yaml
INFO:conda_smithy.configure_feedstock:Applying migrations: /home/straversaro/.cache/conda-smithy/share/conda-forge/migrations/python314.yaml,/home/straversaro/conda-forge-agent-ws/torchcodec-feedstock/.ci_support/migrations/cuda129.yaml,/home/straversaro/.cache/conda-smithy/share/conda-forge/migrations/cuda130.yaml,/home/straversaro/.cache/conda-smithy/share/conda-forge/migrations/pytorch210.yaml
 Processing recipe at path: /home/straversaro/conda-forge-agent-ws/torchcodec-feedstock/recipe/recipe.yaml

 ╭─ Finding outputs from recipe
 │ Loading variant config from: /tmp/tmp6ry9otay
 │ ⚠ warning Found 'pin_run_as_build' in variant config - this is not supported and will be ignored
 │
 ╰─────────────────── (took 0 seconds)
Error:   × Failed to render recipe with variants
  ╰─▶ Jinja template error: Undefined variable(s) in expression: 'arm_variant_type'
   ╭─[/home/straversaro/conda-forge-agent-ws/torchcodec-feedstock/recipe/recipe.yaml:8:27]
 7 │   # ensure arm_variant_type gets detected as a used variable
 8 │   touch_arm_variant_type: ${{ arm_variant_type }}
   ·                           ─┬─
   ·                            ╰── Undefined variable(s) in expression: 'arm_variant_type'
 9 │
   ╰────

Traceback (most recent call last):
  File "/home/straversaro/conda-forge-agent-ws/torchcodec-feedstock/.pixi/envs/smithy/bin/conda-smithy", line 10, in <module>
    sys.exit(main())
  File "/home/straversaro/conda-forge-agent-ws/torchcodec-feedstock/.pixi/envs/smithy/lib/python3.10/site-packages/conda_smithy/cli.py", line 748, in main
    args.subcommand_func(args)
  File "/home/straversaro/conda-forge-agent-ws/torchcodec-feedstock/.pixi/envs/smithy/lib/python3.10/site-packages/conda_smithy/cli.py", line 596, in __call__
    self._call(args, tmpdir)
  File "/home/straversaro/conda-forge-agent-ws/torchcodec-feedstock/.pixi/envs/smithy/lib/python3.10/site-packages/conda_smithy/cli.py", line 601, in _call
    configure_feedstock.main(
  File "/home/straversaro/conda-forge-agent-ws/torchcodec-feedstock/.pixi/envs/smithy/lib/python3.10/site-packages/conda_smithy/configure_feedstock.py", line 2964, in main
    render_info.append(render_azure(env, config, forge_dir, return_metadata=True))
  File "/home/straversaro/conda-forge-agent-ws/torchcodec-feedstock/.pixi/envs/smithy/lib/python3.10/site-packages/conda_smithy/configure_feedstock.py", line 1977, in render_azure
    return _render_ci_provider(
  File "/home/straversaro/conda-forge-agent-ws/torchcodec-feedstock/.pixi/envs/smithy/lib/python3.10/site-packages/conda_smithy/configure_feedstock.py", line 1242, in _render_ci_provider
    metas = rattler_render(
  File "/home/straversaro/conda-forge-agent-ws/torchcodec-feedstock/.pixi/envs/smithy/lib/python3.10/site-packages/rattler_build_conda_compat/render.py", line 318, in render
    metadata_tuples = render_recipe(
  File "/home/straversaro/conda-forge-agent-ws/torchcodec-feedstock/.pixi/envs/smithy/lib/python3.10/site-packages/rattler_build_conda_compat/render.py", line 281, in render_recipe
    recipes = metadata.render_recipes(variants)
  File "/home/straversaro/conda-forge-agent-ws/torchcodec-feedstock/.pixi/envs/smithy/lib/python3.10/site-packages/rattler_build_conda_compat/render.py", line 170, in render_recipes
    raise e
  File "/home/straversaro/conda-forge-agent-ws/torchcodec-feedstock/.pixi/envs/smithy/lib/python3.10/site-packages/rattler_build_conda_compat/render.py", line 162, in render_recipes
    subprocess.run(run_args, check=True, stdout=outfile, env=os.environ)
  File "/home/straversaro/conda-forge-agent-ws/torchcodec-feedstock/.pixi/envs/smithy/lib/python3.10/subprocess.py", line 526, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['rattler-build', 'build', '--render-only', '--recipe', '/home/straversaro/conda-forge-agent-ws/torchcodec-feedstock/recipe', '--target-platform', 'linux-64', '--build-platform', 'linux-64', '-m', '/tmp/tmp6ry9otay']' returned non-zero exit status 1.
straversaro@gblaptop0007:~/conda-forge-agent-ws/torchcodec-feedstock$ pixi list | grep rattle
rattler-build               0.58.4        ha759004_0              17.85 MiB  conda  https://conda.anaconda.org/conda-forge
rattler-build-conda-compat  1.4.11        pyhd8ed1ab_0            44.26 KiB  conda  https://conda.anaconda.org/conda-forge

@carterbox
Copy link
Member

What about this?

touch_arm_variant_type: ${{ arm_variant_type | default("None") }}

@h-vetinari
Copy link
Member

I'm fine with using | default("None") instead of the if: ... guard. My point was that we should move away from the touch_ hack by using the corresponding terms of art from the recipe spec (v1) resp. conda-build implementation (de facto v0 spec).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants